<template>
  <el-dialog
    append-to-body
    :title="info"
    :visible.sync="dialogVisible"
    align="left"
    :close-on-click-modal="false"
    width="1200px">
    <div
      v-loading="currLoading"
      element-loading-text="拼命加载中"
      element-loading-spinner="el-icon-loading"
      element-loading-background="rgba(0, 0, 0, 0.8)"
      v-if="dialogVisible" style="min-height: 400px;">
      <order-express-box :call-reload-detail="getDetail" v-if="dialogVisible && detail.id>0" :detail="detail" :all-express-list="allTypeExpressList"/>
    </div>
  </el-dialog>

</template>

<script>
import OrderExpressBox from '../Common/OrderExpressBox'

export default {
  name: 'OrderExpressDialog',
  components: {OrderExpressBox},
  data: function () {
    return {
      info: '订单物流详情',
      dialogVisible: false,
      currLoading: false,
      detail: {
        "id": 0,
        "orderId": 5,
        "shopId": 7,
        "shopName": "唐久便利",
        "shopLogo": "http://image.yangfankj.com/shop/logo/7.jpg",
        "senderName": "",
        "senderMobile": "",
        "senderAddress": "",
        "receiverName": "",
        "receiverMobile": "",
        "receiverAddress": "",
        "type": {
          "name": "商家发货",
          "id": 0
        },
        "content": [
          {
            "createdAt": "2022-09-16 19:38:44",
            "tagName": "揽收中",
            "content": "商品已经下单"
          }
        ],
        "expressNumber": "SF1631692857167",
        "expressCompany": "顺丰速运",
        "updatedTime": "2022-09-16 19:38:44",
        "createdTime": "2022-09-16 19:38:44"
      },
      allTypeExpressList: {},
    }
  },
  mounted () {
  },
  methods: {
    open: function (detail) {
      // this.detail = detail
      this.getDetail(detail.id)
      this.$forceUpdate()
    },
    getDetail(id){
      let $this=this
      $this.detail={id:0}
      $this.currLoading=true
      $this.dialogVisible=true
      setTimeout(function (){
        $this.MyRequest($this.ApiDoNameSupplier + 'SupplierOrder/getExpressDetail', {id}, function (data) {
          $this.detail = data.orderExpress
          $this.allTypeExpressList = data.allTypeExpressList
          $this.currLoading=false
          $this.$forceUpdate()
        }, function (res) {
          $this.$message.error(res.message)
          $this.loading = false
        })
      },300)
    }
  }
}
</script>

<style scoped>

</style>
